Other forms: double agents
A spy who is pretending to work for one country while really working for that country's enemy is called a double agent.
If you were hired in North Korea to spy on the United States, but you were secretly supplying confidential information about North Korea to the US government, you could call yourself a double agent. Some double agents work for organizations like the CIA, the US Central Intelligence Agency, and their field of expertise is known as "counterintelligence." In some cases, a spy becomes a double agent after their loyalty is turned against their home country.